#!/bin/bash

#menu list and receive input content
menu(){
	echo "1.add user."
	echo "2.del user."
	echo "3.exit"
	read -p "please input your choice:" u_choice
}
#add uesr
add_user(){
	read -p "please input user's name:" u_name
	useradd $u_name && echo "add user $u_name success"
}
#del user
del_user(){
	read -p "please input delete user's name:" d_name
	userdel -r $d_name
	echo "del user $d_name success"
}
#main function
main(){
while :
do
	clear
	menu
	case $u_choice in
	1)
		add_user
		;;
	2)
		del_user
		;;
	3)
		exit
		;;
	*)
		exit
		;;	
	esac
read -p "please press enter to continue"
done
}
main
